package com.rbcs.budget.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

import com.rbcs.base.model.Item;
import com.systop.core.model.BaseModel;

/**
 * 项目预算明细表,关联预算科目,是项目预算的组成部分
 * 
 * @author Nice
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "project_item_budgets")
public class ProjectItemBudget extends BaseModel {

	// 主键
	private Integer id;

	// 预算金额
	private Double amount;

	// 预算科目
	private Item item;

	// 第1次追加
	private Double add1th;
	// 第2次追加
	private Double add2th;
	// 第3次追加
	private Double add3th;
	// 第4次追加
	private Double add4th;

	// 最终金额
	private Double finalAmount;

	// 对应的项目预算
	private ProjectBudget projectBudget;

	@Id
	@GeneratedValue(generator = "hibseq")
	@GenericGenerator(name = "hibseq", strategy = "hilo")
	@Column(name = "id", nullable = false)
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Double getAmount() {
		return amount;
	}

	public void setAmount(Double amount) {
		this.amount = amount;
	}

	public Double getAdd1th() {
		return add1th;
	}

	public void setAdd1th(Double add1th) {
		this.add1th = add1th;
	}

	public Double getAdd2th() {
		return add2th;
	}

	public void setAdd2th(Double add2th) {
		this.add2th = add2th;
	}

	public Double getAdd3th() {
		return add3th;
	}

	public void setAdd3th(Double add3th) {
		this.add3th = add3th;
	}

	public Double getAdd4th() {
		return add4th;
	}

	public void setAdd4th(Double add4th) {
		this.add4th = add4th;
	}

	public Double getFinalAmount() {
		return finalAmount;
	}

	public void setFinalAmount(Double finalAmount) {
		this.finalAmount = finalAmount;
	}

	// 财务科目
	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "item_id")
	public Item getItem() {
		return item;
	}

	public void setItem(Item item) {
		this.item = item;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumn(name = "project_budget_id")
	public ProjectBudget getProjectBudget() {
		return projectBudget;
	}

	public void setProjectBudget(ProjectBudget projectBudget) {
		this.projectBudget = projectBudget;
	}
}
